<?php

namespace app\model\activity\free;

use crmeb\basic\BaseModel;
use crmeb\traits\ModelTrait;

class StoreFreeRule extends BaseModel
{
    /**
     * 数据表主键
     * @var string
     */
    protected $pk = 'id';

    /**
     * 模型名称
     * @var string
     */
    protected $name = 'store_free_rules';

    use ModelTrait;

    // 定义 zg_free_rule_products 表的关联关系
    public function products()
    {
        return $this->hasMany(FreeRuleProduct::class, 'free_rule_id', 'id');
    }

    public function free()
    {
        return $this->belongsTo(StoreFree::class, 'free_id', 'id');
    }
}